package com.hibernate.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.javacommon.base.BaseEntity;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

/**
 * 时段分布
 */
@Entity
@Table(name = "REPORT_DAY_HOUR")
@org.hibernate.annotations.Entity(mutable=false)
public class ReportDayHour extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "广告效果时间分布";
	public static final String ALIAS_ID = "ID";
	public static final String ALIAS_USER_ID = "用户ID";
	public static final String ALIAS_AD_OWNER_ID = "广告客户ID";
	public static final String ALIAS_AD_ORDER_ID = "订单ID";
	public static final String ALIAS_AD_PLAN_ID = "计划ID";
	public static final String ALIAS_MATERIAL_ID = "物料ID";
	public static final String ALIAS_CHANNELS_ID = "渠道ID";
	public static final String ALIAS_WEBSITE_ID = "网站ID";
	public static final String ALIAS_LABEL_ID = "栏目ID";
	public static final String ALIAS_AD_SITE_ID = "广告位ID";
	public static final String ALIAS_PROPERTY_VALUE_ID = "人群属性值ID";
	public static final String ALIAS_SHOW_PV = "物料曝光PV";
	public static final String ALIAS_SHOW_UV = "物料曝光UV";
	public static final String ALIAS_CLICK_PV = "物料点击PV";
	public static final String ALIAS_CLICK_UV = "物料点击UV";
	public static final String ALIAS_CONVERT_PV = "总计转换PV";
	public static final String ALIAS_CONVERT_UV = "总计转换UV";
	public static final String ALIAS_SHOW_CONVERT_PV = "用户看了广告但没有点击并产生了转换，PV";
	public static final String ALIAS_SHOW_CONVERT_UV = "用户看了广告但没有点击并产生了转换，UV";
	public static final String ALIAS_CLICK_CONVERT_PV = "用户看了广告并点击了并产生了转换，PV";
	public static final String ALIAS_CLICK_CONVERT_UV = "用户看了广告并点击了并产生了转换，UV";
	public static final String ALIAS_ACCESS_CONVERT_PV = "用户通过非广告点击方式访问网站产生了转换，PV";
	public static final String ALIAS_ACCESS_CONVERT_UV = "用户通过非广告点击方式访问网站产生了转换，UV";
	public static final String ALIAS_ACCESS_PV = "网站访问PV";
	public static final String ALIAS_ACCESS_UV = "网站访问UV";
	public static final String ALIAS_TWO_JUMP_PV = "二跳PV";
	public static final String ALIAS_TWO_JUMP_UV = "二跳UV";
	public static final String ALIAS_LOG_DATE = "日期，精确到天";
	
	//date formats
	

	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * ID       db_column: ID 
     */ 	
	
	private Long id;
    /**
     * 小时       db_column: hour 
     */ 	
	@NotNull 
	private int hour;
    /**
     * 用户ID       db_column: USER_ID 
     */ 	
	@NotNull 
	private Long userId;
    /**
     * 广告客户ID       db_column: AD_OWNER_ID 
     */ 	
	@NotNull 
	private Long adOwnerId;
    /**
     * 订单ID       db_column: AD_ORDER_ID 
     */ 	
	@NotNull 
	private Long adOrderId;
    /**
     * 计划ID       db_column: AD_PLAN_ID 
     */ 	
	@NotNull 
	private Long adPlanId;
    /**
     * 物料ID       db_column: MATERIAL_ID 
     */ 	
	@NotNull 
	private Long materialId;
    /**
     * 渠道ID       db_column: CHANNELS_ID 
     */ 	
	@NotNull 
	private Long channelsId;
    /**
     * 网站ID       db_column: WEBSITE_ID 
     */ 	
	@NotNull 
	private Long websiteId;
    /**
     * 栏目ID       db_column: LABEL_ID 
     */ 	
	@NotNull 
	private Long labelId;
    /**
     * 广告位ID       db_column: AD_SITE_ID 
     */ 	
	@NotNull 
	private Long adSiteId;
    /**
     * 人群属性值ID       db_column: PROPERTY_VALUE_ID 
     */ 	
	@NotNull 
	private Long propertyValueId;
    /**
     * 物料曝光PV       db_column: SHOW_PV 
     */ 	
	@NotNull 
	private Long showPv;
    /**
     * 物料曝光UV       db_column: SHOW_UV 
     */ 	
	@NotNull 
	private Long showUv;
    /**
     * 物料点击PV       db_column: CLICK_PV 
     */ 	
	@NotNull 
	private Long clickPv;
    /**
     * 物料点击UV       db_column: CLICK_UV 
     */ 	
	@NotNull 
	private Long clickUv;
    /**
     * 总计转换PV       db_column: CONVERT_PV 
     */ 	
	@NotNull 
	private Long convertPv;
    /**
     * 总计转换UV       db_column: CONVERT_UV 
     */ 	
	@NotNull 
	private Long convertUv;
    /**
     * 用户看了广告但没有点击并产生了转换，PV       db_column: SHOW_CONVERT_PV 
     */ 	
	@NotNull 
	private Long showConvertPv;
    /**
     * 用户看了广告但没有点击并产生了转换，UV       db_column: SHOW_CONVERT_UV 
     */ 	
	@NotNull 
	private Long showConvertUv;
    /**
     * 用户看了广告并点击了并产生了转换，PV       db_column: CLICK_CONVERT_PV 
     */ 	
	@NotNull 
	private Long clickConvertPv;
    /**
     * 用户看了广告并点击了并产生了转换，UV       db_column: CLICK_CONVERT_UV 
     */ 	
	@NotNull 
	private Long clickConvertUv;
    /**
     * 用户通过非广告点击方式访问网站产生了转换，PV       db_column: ACCESS_CONVERT_PV 
     */ 	
	@NotNull 
	private Long accessConvertPv;
    /**
     * 用户通过非广告点击方式访问网站产生了转换，UV       db_column: ACCESS_CONVERT_UV 
     */ 	
	@NotNull 
	private Long accessConvertUv;
    /**
     * 网站访问PV       db_column: ACCESS_PV 
     */ 	
	@NotNull 
	private Long accessPv;
    /**
     * 网站访问UV       db_column: ACCESS_UV 
     */ 	
	@NotNull 
	private Long accessUv;
    /**
     * 二跳PV       db_column: TWO_JUMP_PV 
     */ 	
	@NotNull 
	private Long twoJumpPv;
    /**
     * 二跳UV       db_column: TWO_JUMP_UV 
     */ 	
	@NotNull 
	private Long twoJumpUv;
    /**
     * 日期，精确到天       db_column: LOG_DATE 
     */ 	
	@NotBlank @Length(max=10)
	private java.lang.String logDate;
	//columns END


	public ReportDayHour(){
	}

	public void setId(Long value) {
		this.id = value;
	}
	
	@Id 	@GeneratedValue(generator = "paymentableGenerator")       
	@GenericGenerator(name = "paymentableGenerator", strategy = "native") 
	@Column(name = "ID", unique = true, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getId() {
		return this.id;
	}

	public void setHour(int hour) {
		this.hour = hour;
	}
	
	@Column(name = "hour", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public int getHour() {
		return hour;
	}
	
	@Column(name = "USER_ID", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getUserId() {
		return this.userId;
	}
	
	public void setUserId(Long value) {
		this.userId = value;
	}
	
	@Column(name = "AD_OWNER_ID", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getAdOwnerId() {
		return this.adOwnerId;
	}
	
	public void setAdOwnerId(Long value) {
		this.adOwnerId = value;
	}
	
	@Column(name = "AD_ORDER_ID", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getAdOrderId() {
		return this.adOrderId;
	}
	
	public void setAdOrderId(Long value) {
		this.adOrderId = value;
	}
	
	@Column(name = "AD_PLAN_ID", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getAdPlanId() {
		return this.adPlanId;
	}
	
	public void setAdPlanId(Long value) {
		this.adPlanId = value;
	}
	
	@Column(name = "MATERIAL_ID", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getMaterialId() {
		return this.materialId;
	}
	
	public void setMaterialId(Long value) {
		this.materialId = value;
	}
	
	@Column(name = "CHANNELS_ID", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getChannelsId() {
		return this.channelsId;
	}
	
	public void setChannelsId(Long value) {
		this.channelsId = value;
	}
	
	@Column(name = "WEBSITE_ID", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getWebsiteId() {
		return this.websiteId;
	}
	
	public void setWebsiteId(Long value) {
		this.websiteId = value;
	}
	
	@Column(name = "LABEL_ID", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getLabelId() {
		return this.labelId;
	}
	
	public void setLabelId(Long value) {
		this.labelId = value;
	}
	
	@Column(name = "AD_SITE_ID", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getAdSiteId() {
		return this.adSiteId;
	}
	
	public void setAdSiteId(Long value) {
		this.adSiteId = value;
	}
	
	@Column(name = "PROPERTY_VALUE_ID", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getPropertyValueId() {
		return this.propertyValueId;
	}
	
	public void setPropertyValueId(Long value) {
		this.propertyValueId = value;
	}
	
	@Column(name = "SHOW_PV", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getShowPv() {
		return this.showPv;
	}
	
	public void setShowPv(Long value) {
		this.showPv = value;
	}
	
	@Column(name = "SHOW_UV", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getShowUv() {
		return this.showUv;
	}
	
	public void setShowUv(Long value) {
		this.showUv = value;
	}
	
	@Column(name = "CLICK_PV", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getClickPv() {
		return this.clickPv;
	}
	
	public void setClickPv(Long value) {
		this.clickPv = value;
	}
	
	@Column(name = "CLICK_UV", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getClickUv() {
		return this.clickUv;
	}
	
	public void setClickUv(Long value) {
		this.clickUv = value;
	}
	
	@Column(name = "CONVERT_PV", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getConvertPv() {
		return this.convertPv;
	}
	
	public void setConvertPv(Long value) {
		this.convertPv = value;
	}
	
	@Column(name = "CONVERT_UV", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getConvertUv() {
		return this.convertUv;
	}
	
	public void setConvertUv(Long value) {
		this.convertUv = value;
	}
	
	@Column(name = "SHOW_CONVERT_PV", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getShowConvertPv() {
		return this.showConvertPv;
	}
	
	public void setShowConvertPv(Long value) {
		this.showConvertPv = value;
	}
	
	@Column(name = "SHOW_CONVERT_UV", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getShowConvertUv() {
		return this.showConvertUv;
	}
	
	public void setShowConvertUv(Long value) {
		this.showConvertUv = value;
	}
	
	@Column(name = "CLICK_CONVERT_PV", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getClickConvertPv() {
		return this.clickConvertPv;
	}
	
	public void setClickConvertPv(Long value) {
		this.clickConvertPv = value;
	}
	
	@Column(name = "CLICK_CONVERT_UV", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getClickConvertUv() {
		return this.clickConvertUv;
	}
	
	public void setClickConvertUv(Long value) {
		this.clickConvertUv = value;
	}
	
	@Column(name = "ACCESS_CONVERT_PV", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getAccessConvertPv() {
		return this.accessConvertPv;
	}
	
	public void setAccessConvertPv(Long value) {
		this.accessConvertPv = value;
	}
	
	@Column(name = "ACCESS_CONVERT_UV", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getAccessConvertUv() {
		return this.accessConvertUv;
	}
	
	public void setAccessConvertUv(Long value) {
		this.accessConvertUv = value;
	}
	
	@Column(name = "ACCESS_PV", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getAccessPv() {
		return this.accessPv;
	}
	
	public void setAccessPv(Long value) {
		this.accessPv = value;
	}
	
	@Column(name = "ACCESS_UV", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getAccessUv() {
		return this.accessUv;
	}
	
	public void setAccessUv(Long value) {
		this.accessUv = value;
	}
	
	@Column(name = "TWO_JUMP_PV", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getTwoJumpPv() {
		return this.twoJumpPv;
	}
	
	public void setTwoJumpPv(Long value) {
		this.twoJumpPv = value;
	}
	
	@Column(name = "TWO_JUMP_UV", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getTwoJumpUv() {
		return this.twoJumpUv;
	}
	
	public void setTwoJumpUv(Long value) {
		this.twoJumpUv = value;
	}
	
	@Column(name = "LOG_DATE", unique = false, nullable = false, insertable = true, updatable = true, length = 10)
	public java.lang.String getLogDate() {
		return this.logDate;
	}
	
	public void setLogDate(java.lang.String value) {
		this.logDate = value;
	}

	private Material material;
	public void setMaterial(Material material){
		this.material = material;
	}
	
	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumns({
		@JoinColumn(name = "MATERIAL_ID",nullable = false, insertable = false, updatable = false) 
	})
	public Material getMaterial() {
		return material;
	}
	
	private Channels channels;
	public void setChannels(Channels channels){
		this.channels = channels;
	}
	
	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumns({
		@JoinColumn(name = "CHANNELS_ID",nullable = false, insertable = false, updatable = false) 
	})
	public Channels getChannels() {
		return channels;
	}
	
	private AdPlan adPlan;
	public void setAdPlan(AdPlan adPlan){
		this.adPlan = adPlan;
	}
	
	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumns({
		@JoinColumn(name = "AD_PLAN_ID",nullable = false, insertable = false, updatable = false) 
	})
	public AdPlan getAdPlan() {
		return adPlan;
	}
	
	private Label label;
	public void setLabel(Label label){
		this.label = label;
	}
	
	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumns({
		@JoinColumn(name = "LABEL_ID",nullable = false, insertable = false, updatable = false) 
	})
	public Label getLabel() {
		return label;
	}
	
	private AdOrder adOrder;
	public void setAdOrder(AdOrder adOrder){
		this.adOrder = adOrder;
	}
	
	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumns({
		@JoinColumn(name = "AD_ORDER_ID",nullable = false, insertable = false, updatable = false) 
	})
	public AdOrder getAdOrder() {
		return adOrder;
	}
	
	private AdOwner adOwner;
	public void setAdOwner(AdOwner adOwner){
		this.adOwner = adOwner;
	}
	
	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumns({
		@JoinColumn(name = "AD_OWNER_ID",nullable = false, insertable = false, updatable = false) 
	})
	public AdOwner getAdOwner() {
		return adOwner;
	}
	
	private AdSite adSite;
	public void setAdSite(AdSite adSite){
		this.adSite = adSite;
	}
	
	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumns({
		@JoinColumn(name = "AD_SITE_ID",nullable = false, insertable = false, updatable = false) 
	})
	public AdSite getAdSite() {
		return adSite;
	}

	private Website website;
	public void setWebsite(Website website){
		this.website = website;
	}
	
	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumns({
		@JoinColumn(name = "WEBSITE_ID",nullable = false, insertable = false, updatable = false) 
	})
	public Website getWebsite() {
		return website;
	}
	
//	private PeoplePropertyValue peoplePropertyValue;
//	public void setPeoplePropertyValue(PeoplePropertyValue peoplePropertyValue){
//		this.peoplePropertyValue = peoplePropertyValue;
//	}
//	
//	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
//	@JoinColumns({
//		@JoinColumn(name = "PROPERTY_VALUE_ID",nullable = false, insertable = false, updatable = false) 
//	})
//	public PeoplePropertyValue getPeoplePropertyValue() {
//		return peoplePropertyValue;
//	}
	
	private CategoryInfoMap peoplePropertyValue;
	public void setPeoplePropertyValue(CategoryInfoMap peoplePropertyValue){
		this.peoplePropertyValue = peoplePropertyValue;
	}
	
	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumns({
		@JoinColumn(name = "PROPERTY_VALUE_ID",nullable = false, insertable = false, updatable = false) 
	})
	public CategoryInfoMap getPeoplePropertyValue() {
		return peoplePropertyValue;
	}
	
	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Id",getId())
			.append("UserId",getUserId())
			.append("AdOwnerId",getAdOwnerId())
			.append("AdOrderId",getAdOrderId())
			.append("AdPlanId",getAdPlanId())
			.append("MaterialId",getMaterialId())
			.append("ChannelsId",getChannelsId())
			.append("WebsiteId",getWebsiteId())
			.append("LabelId",getLabelId())
			.append("AdSiteId",getAdSiteId())
			.append("PropertyValueId",getPropertyValueId())
			.append("ShowPv",getShowPv())
			.append("ShowUv",getShowUv())
			.append("ClickPv",getClickPv())
			.append("ClickUv",getClickUv())
			.append("ConvertPv",getConvertPv())
			.append("ConvertUv",getConvertUv())
			.append("ShowConvertPv",getShowConvertPv())
			.append("ShowConvertUv",getShowConvertUv())
			.append("ClickConvertPv",getClickConvertPv())
			.append("ClickConvertUv",getClickConvertUv())
			.append("AccessConvertPv",getAccessConvertPv())
			.append("AccessConvertUv",getAccessConvertUv())
			.append("AccessPv",getAccessPv())
			.append("AccessUv",getAccessUv())
			.append("TwoJumpPv",getTwoJumpPv())
			.append("TwoJumpUv",getTwoJumpUv())
			.append("LogDate",getLogDate())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof ReportDayHour == false) return false;
		if(this == obj) return true;
		ReportDayHour other = (ReportDayHour)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.isEquals();
	}
	@Transient
	@Override
	public String getTarget() {
		// TODO Auto-generated method stub
		return null;
	}
	@Transient
	@Override
	public Long getTargetId() {
		// TODO Auto-generated method stub
		return null;
	}
	@Transient
	@Override
	public String getTargetName() {
		// TODO Auto-generated method stub
		return null;
	}
}

